package com.example.myapplicationsenior;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class systemReceiver extends BroadcastReceiver {
    private static final String TAG = "systemReceiver";
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i(TAG, "onReceive: ------");
        String action = intent.getAction();
        if(Intent.ACTION_SCREEN_ON.equals(action)){ //不能用
            Log.i(TAG, "onReceive: 亮了");
        }else if(Intent.ACTION_SCREEN_OFF.equals(action)){//不能用
            Log.i(TAG, "onReceive: 暗了");
        }else if (Intent.ACTION_USER_PRESENT.equals(action)){
            Log.i(TAG, "onReceive: 唤醒了");
        }else if(Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(action)){
            Log.i(TAG, "onReceive: 飞行了");
        }
    }
}
